#include <windows.h>
#include <windowsx.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <vector>

#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 600

#pragma comment (lib, "d3d9.lib")
#pragma comment (lib, "d3dx9.lib")

class Sprite
{
public:
	float x=0, y=0;
private:
	float z = 0; //needed to make &x a valid D3DXVECTOR3*
public:
	float r = 0, level=0;
	float scaleX = 1.0f, scaleY = 1.0f;
	UINT Width=0, Height=0;
	LPDIRECT3DTEXTURE9 Texture;
	D3DXCOLOR Color = 0xFFFFFFFF;
	Sprite();
	Sprite(UINT, UINT, LPDIRECT3DTEXTURE9);
};

class D3DEngine
{
	public:
		LPDIRECT3D9 d3d;
		LPDIRECT3DDEVICE9 d3ddev;
		LPD3DXSPRITE pSprite;
		LPDIRECT3DTEXTURE9 Default;
		std::vector<Sprite*> Sprites;

		D3DEngine(HWND);
		void RenderFrame();
		void DrawSprites();
		Sprite D3DEngine::CreateSprite(LPCWSTR f);
		void AddSprite(Sprite*);
		void RemoveSprite(Sprite*);
		void Dispose();
};
